package info.help;

public class MMisc {
    
        public static  int zufall(int u, int o){
            return (int)(Math.random() * o + u);
        }
    
	public static int bool_to_int(boolean b){
		if(b){
			return 1;
		} else {
			return 0;
		}
	}
	
	public static boolean int_to_boolean(int i){
		return (i)>0;
	}
	
	
	public static int versionCompare(String str1, String str2)
	{
	    String[] vals1 = str1.split("\\.");
	    String[] vals2 = str2.split("\\.");
	    int i = 0;
	    // set index to first non-equal ordinal or length of shortest version string
	    while (i < vals1.length && i < vals2.length && vals1[i].equals(vals2[i])) 
	    {
	      i++;
	    }
	    // compare first non-equal ordinal number
	    if (i < vals1.length && i < vals2.length) 
	    {
	        int diff = Integer.valueOf(vals1[i]).compareTo(Integer.valueOf(vals2[i]));
	        return Integer.signum(diff);
	    }
	    // the strings are equal or one string is a substring of the other
	    // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4"
	    else
	    {
	        return Integer.signum(vals1.length - vals2.length);
	    }
	}

    public static void msgBox(String s){
        
    }
}
